package com.xingyun.kingdee.erp.common.model.param.opt;

import com.alibaba.fastjson.annotation.JSONField;
import com.xingyun.kingdee.erp.common.model.param.base.AbstractErpParam;
import com.xingyun.kingdee.erp.common.model.param.base.ErpLoginParam;
import com.xingyun.kingdee.erp.common.model.param.opt.content.BillQueryParamContent;
import io.swagger.annotations.ApiModel;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

/**
 * <p>Title: erp单据查询服务接口请求参数</p>
 * <p>Description: </p>
 *
 * @author zhangxiong
 * @date 2020年04月02日
 */
@ApiModel(value = "表单查询参数")
@Setter
@Getter
@ToString
public class ErpBillQueryParam extends AbstractErpParam {

    @NotNull
    @Valid
    @JSONField(name = "data")
    private BillQueryParamContent paramContent;

    public ErpBillQueryParam() {
    }

    public static ErpBillQueryParam from(ErpLoginParam loginParam,String formId,String fieldKeys,String filterString){
        ErpBillQueryParam erpBillQueryParam = new ErpBillQueryParam();
        BillQueryParamContent paramContent = new BillQueryParamContent();
        paramContent.setFormId(formId);
        erpBillQueryParam.setParamContent(paramContent);
        paramContent.setFieldKeys(fieldKeys);
        paramContent.setFilterString(filterString);
        erpBillQueryParam.setErpLoginParam(loginParam);
        return erpBillQueryParam;
    }
}
